﻿using Framework;
using LogicAnalyzerCommon;

using NUnit.Framework;
using NUnit.Framework.SyntaxHelpers;

namespace UnitTests
{
    [TestFixture]
    public class TestFrameworkExtensionMethods
    {
        [Test]
        public void TestPrettyPrintFrequency()
        {
            Assert.That(1L.PrettyPrintFrequency(), Is.EqualTo("1 Hz"));
            Assert.That(100L.PrettyPrintFrequency(), Is.EqualTo("100 Hz"));
            Assert.That(1000L.PrettyPrintFrequency(), Is.EqualTo("1 kHz"));
            Assert.That(10000L.PrettyPrintFrequency(), Is.EqualTo("10 kHz"));
            Assert.That(1000000L.PrettyPrintFrequency(), Is.EqualTo("1 MHz"));
        }

        [Test]
        public void TestPrettyPrintTime()
        {
            double time = 1.0;
            Assert.That(time.PrettyPrintTime(), Is.EqualTo("1 s"));
            time = 0.1;
            Assert.That(time.PrettyPrintTime(), Is.EqualTo("100 ms"));
            time = 0.999;
            Assert.That(time.PrettyPrintTime(), Is.EqualTo("999 ms"));
            time = 0.001;
            Assert.That(time.PrettyPrintTime(), Is.EqualTo("1 ms"));
            time = 0.0001;
            Assert.That(time.PrettyPrintTime(), Is.EqualTo("100 us"));
        }
    }
}
